<template>
  <div class="item-box">
    <div class="item">
      <div class="img">
        <img :src="user.img" alt="" />
      </div>
      <div class="info">
        <p>
          <span>ID</span>:<span>{{ user.id }}</span>
        </p>
        <p>
          <span>姓名</span>:<span>{{ user.name }}</span>
        </p>
        <p>
          <span>性别</span>:<span>{{ user.sex }}</span>
        </p>
        <p>
          <span>手机号码</span>:<span>{{ user.tel }}</span>
        </p>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    user: {
      type: Object,
      default() {
        return {};
      },
    },
  },
};
</script>
<style scoped>
.item-box {
  padding: 0px 20px;
  margin-bottom: 40px;
  width: 400px;
  box-sizing: border-box;
  display: inline-block;
}

.item {
  height: 150px;
  box-shadow: 0px 0px 12px #999;
  border-radius: 12px;
  /* overflow: hidden; */
  position: relative;
}

.img {
  width: 150px;
  height: 150px;
}

.img > img {
  width: 100%;
  height: 100%;
  border-radius: 12px 0px 0px 12px;
  /*  */
  object-fit: cover;
  object-position: center top;
}

.info {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0px;
  left: 0px;
  padding: 16px 16px 16px 166px;
  box-sizing: border-box;
  display: flex;
  flex-flow: column nowrap;
}

.info p {
  flex-grow: 1;
  align-self: center;
  /*  */
  line-height: 1.6;
  margin: 0px;
  width: 100%;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  cursor: pointer;
}

.info p:last-child:hover {
  width: auto;
  background-color: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 0px 6px;
  box-shadow: 0px 0px 10px #666;
  border-radius: 6px;
}

.info span:first-child {
  padding-right: 8px;
  color: #999;
  display: inline-block;
  width: 65px;
  /*  */
  text-align: justify;
  text-align-last: justify;
}

.info span:last-child {
  padding-left: 8px;
}
</style>